Hello,
#include <utils/copyops.inc>
pragma runLim,0
DB createLS = create ("DXL-Attribute", styleStandard|styleCentered)
const string NameAttrDXL = "DXL for RTM"
const string FQ = "????"
const string modIDFQ = "????"
const string FQ34 = "????"
const string modIDFQ34 = "????"
const string HN = "????"
const string modIDHN = "????"
string modID = null
if (getDatabaseIdentifier() == FQ) {
modID = modIDFQ
}else if (getDatabaseIdentifier() == FQ34) {
modID = modIDFQ34
}else if (getDatabaseIdentifier() == HN) {
modID = modIDHN
}else { errorBox("Unknown state!"); halt; }
const string cMod = fullName current Module
Module modTgt = edit (cMod, true, false, true) //switch Source Module to Edit-mode
if (!isEdit modTgt || ! canCreate modTgt) { infoBox("not editable"); halt; }
// Calculate Object count
int cnt = 0
int total = 0
for obj in entire modTgt do {
if(null obj || isDeleted(obj)) continue
cnt++
}
void RTMdlxATTR()
{
//http://www.ibm.com/developerworks/forums/thread.jspa?threadID=455956&tstart=15
Module EP0304 = load (moduleVersion(modID), false) //Master Template
if (null EP0304) { errorBox("Failed to open the module template!"); halt; }
Skip attrList = create()
put(attrList, 0, "RTM")
put(attrList, 1, "DXL for RTM")
string sAttrName = null
for sAttrName in attrList do {
AttrDef adSrc = find(EP0304, sAttrName)
if (null adSrc) { errorBox("Null {"sAttrName"}") }
else {
AttrDef adTgt = find (modTgt, sAttrName)
if (!null adTgt) { /* inform user that attribute exists, and ask if he wants to overwrite */
} else {
copyAttrDefRename_ (adSrc, EP0304, modTgt, sAttrName) }
}
}
close EP0304
delete attrList
}
void refreshDXLAttr(Module m)
{
Object o
ExternalLink extLink
AttrDef ad
string attrName
if (null m) {
ack getExtMsg("String_No_current_module", NLSTEMP_("No current module"))
halt
}
for ad in m do {
if (!ad.dxl) continue
attrName = ad.name
if ( ad.object ) {
for o in m do {
o.attrName = null
for extLink in o->(NLS_("*")) do {
extLink.attrName = null
}
for extLink in o<-(NLS_("*")) do {
extLink.attrName = null
}
}
}
if (ad.module) {
//Clear the module attribute to null to force re-calculation
m.attrName = null
}
}
refresh m
}
void Update(DB win)
{
RTMdlxATTR()
refreshDXLAttr(modTgt)
progressStart(createLS, "Re-calculation object(s)", "objects of", total)
total = cnt
cnt = 0
string Value = null
Object obj = null
for obj in entire modTgt do {
if(null obj || isDeleted(obj)) continue
progressStep (cnt++)
progressMessage "Processing object(" obj."Absolute Number" ") {" cnt " of " total "}"
Value = obj.NameAttrDXL
if (progressCancelled) {
if (confirm ("Are you sure you wish to quit?")) {
progressStop
halt
}
}
}
progressStop
refresh modTgt
destroy createLS
createLS = null
}
apply (createLS, "Update", Update)
realize (createLS)
setSize (createLS, 250, 70)
show (createLS)
SystemAdmin - Wed Nov 14 10:34:35 EST 2012 |
Re: progressStep not working help needed!!! progressStart(createLS, "Re-calculation object(s)", "objects of", total) total = cnt |
Re: progressStep not working help needed!!! Rolan - Wed Nov 14 12:02:48 EST 2012 |